package com.snoob.lixing.dataSource;

/**
 * Created with IntelliJ IDEA
 * User: lixing
 * Date: 2018/11/27 9:52
 * <p>
 * DataSourceContextHolder.setDbSource(DataSourceEnum.gdd_remote.getName());
 */
public class DataSourceContextHolder {

    private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();

    public static void setDbSource(String dbSource) {
        contextHolder.set(dbSource);
    }

    public static String getDbSource() {
        return ((String) contextHolder.get());
    }

    public static void clearDbSource() {
        contextHolder.remove();
    }
}
